package com.ah.shanxi_demo.controller.web;

import com.ah.shanxi_demo.param.input.OrderTrendPO;
import com.ah.shanxi_demo.param.result.OrderTypeRO;
import com.ah.shanxi_demo.param.result.SXResult;
import com.ah.shanxi_demo.service.impl.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zt 2020/8/25
 */

@RestController
@Api(value = "陕西高速", description = "陕西高速-图形展示")
@RequestMapping(value = "/api/v1/shanxi/graph/")
public class ApiGraph {

    private static final Logger log = LoggerFactory.getLogger(ApiGraph.class);

    @Autowired
    private OrderService orderService;

    @ApiOperation(value = "工单类型查询", notes = "工单类型查询")
    @RequestMapping(value = "orderType", method = RequestMethod.POST)
    public SXResult<List<OrderTypeRO>> orderType() {

        try {
            return SXResult.instance(orderService.selectOrderType());
        }catch (Throwable e){
            log.error("ApiGraph 【orderType】" + e.getMessage());
        }
        return SXResult.instance();

    }

    @ApiOperation(value = "工单趋势查询", notes = "工单趋势查询")
    @RequestMapping(value = "orderTrend", method = RequestMethod.POST)
    public SXResult<List<OrderTypeRO>> orderTrend(@RequestBody OrderTrendPO orderTrendPO) {

        try {
            return SXResult.instance(orderService.selectOrderTrend());
        }catch (Throwable e){
            log.error("ApiGraph 【orderTrend】" + e.getMessage());
        }

        return SXResult.instance();
    }




}
